package com.xy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@EnableJpaRepositories(basePackages = "com.xy.repository") // 显式启用JPA仓库扫描
@EntityScan(basePackages = "com.xy.repository.entity, com.xy.entity")
@RestController
@Configuration
@PropertySource("classpath:config.properties")
public class WritApplication {
    public static void main(String[] args) {
        SpringApplication.run(WritApplication.class, args);
    }

    @GetMapping("/health")
    public String healthCheck() {
        return "Application is running";
    }
}
